package com.carbonxsilicon.travellersbuddy;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

/**
 * Created by demouser on 8/15/13.
 */
public class SignInActivity extends Activity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_signin);

    }

    public void onAttemptedLogin (View view) {

        EditText username = (EditText) findViewById(R.id.UsernameField);
        EditText password = (EditText) findViewById(R.id.PasswordField);

        if ((username.getText().toString().equals("u")) && (password.getText().toString().equals("p"))) {

            Intent intent = new Intent(SignInActivity.this, MainActivity.class);
            startActivity(intent);

        }

        else if ((username.getText().toString().equals("profile")) && (password.getText().toString().equals(""))) {

            Intent intent = new Intent(SignInActivity.this, ProfileActivity.class);
            startActivity(intent);

        }



        else if ((username.getText().toString().equals("Leanne Hobbs")) && (password.getText().toString().equals("password"))) {

            Intent intent = new Intent(SignInActivity.this, MainActivity.class);
            startActivity(intent);

        }

        else {

            Toast.makeText(getApplicationContext(), "Sorry, username/password does not match", Toast.LENGTH_LONG).show();

        }



    }
}